import http from '@/utils/http/axios'
import {ContentTypeEnum} from '@/enums/httpEnum'

enum Api {
    roleList = '/role/rolelist',
    roleCreate = '/role/addRole',
    roleDelete = '/role/deleteRole',
    roleUpdate = '/role/updateRole',
    roleAuth = '/role/roleAuth',
}

/**
 * @description: 角色授权
 */
export function roleAuth(params: any) {
    return http.request({
        url: Api.roleAuth,
        method: 'POST',
        params,
    },{
        isTransformRequestResult: false,
        isShowMessage: true,
        successMessageText: '操作成功',
        errorMessageText: '操作失败'
    })
}

/**
 * @description: 修改
 */
export function roleUpdate(params: any) {
    return http.request({
        url: Api.roleUpdate,
        method: 'POST',
        params,
    },{
        isTransformRequestResult: false,
        isShowMessage: true,
        successMessageText: '修改成功',
        errorMessageText: '修改失败'
    })
}

/**
 * @description: 删除
 */
export function roleDelete(params: any) {
    return http.request({
        url: Api.roleDelete,
        method: 'POST',
        params,
    },{
        isTransformRequestResult: false,
        isShowMessage: true,
        successMessageText: '删除成功',
        errorMessageText: '删除失败'
    })
}

/**
 * @description: 添加
 */
export function roleCreate(params: any) {
    return http.request({
        url: Api.roleCreate,
        method: 'POST',
        params,
    },{
        isTransformRequestResult: false,
        isShowMessage: true,
        successMessageText: '添加成功',
        errorMessageText: '添加失败'
    })
}

/**
 * @description: 获取
 */
export function roleList(params: any) {
    return http.request({
        url: Api.roleList,
        method: 'GET',
        params,
    },{
        isTransformRequestResult: false
    })
}
